// vite.config.js
import {
	loadEnv
} from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
// import {
// 	createSvgIconsPlugin
// } from 'vite-plugin-svg-icons';
import path from 'path';
export default (command, mode) => {
	const env = loadEnv(mode, __dirname, 'SHOPRO_');
	const isAppPlus = env.UNI_PLATFORM === 'app-plus';
	return {
		publicPath:'./',
		envPrefix: "SHOPRO_",
		plugins: [
			uni(),

		],
		server: {
			host: true,
			port: env.SHOPRO_DEV_PORT || 3000,
			hmr: {
				overlay: true,
			}
		},
		resolve: {
			alias: {
				events: 'events', // 或者用一个浏览器版本的事件模块
				buffer: 'buffer',
				'@': '/',
				'vendor': '/vendor'
			},
		},
		build: {
			base: './',
			assetsDir: 'assets',
		}
	};
};